package com.eddy.project.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.eddy.project.model.domain.Post;
import com.eddy.project.model.dto.post.crud.PostQueryRequest;
import com.eddy.project.model.vo.PostVO;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 51487
 * @description 针对表【post(帖子)】的数据库操作Service
 * @createDate 2024-04-02 17:06:45
 */
public interface PostService extends IService<Post> {

    /**
     * 校验添加 的bean
     * @param post
     * @param b
     */
    void validPost(Post post, boolean b);

    /**
     * 封装包装类 包括源javabean 的基本字段和扩展字段
     * @param post
     * @param request
     * @return
     */
    PostVO getPostVO(Post post, HttpServletRequest request);

    /**
     * 拼接查询条件（根据 javabean 的字段）
     * @param postQueryRequest
     * @return
     */
    Wrapper<Post> getQueryWrapper(PostQueryRequest postQueryRequest);

    /**
     * 根据拼接查询条件查询列表，分页
     * @param postQueryRequest
     * @return
     */
    Page<PostVO> listPostVOByPage(PostQueryRequest postQueryRequest, HttpServletRequest request);

}
